package com.tywj.test.lib.kotlin

fun main(args: Array<String>) {

    val list = ArrayList<Int>()
    list.add(0)   //0
    list.add(5)  //5
    list.add(8)  //13
    list.add(2)   //15
    list.add(10)   //25


    var totalTime = 0
    list.forEachIndexed { index, k ->
        for (i in 0..index) {
            if (i == index) {
                totalTime += k
                println("当前第$index" + "值为" + k + ",当前时间总和 :$totalTime")
                break
            }
        }
    }
}
